import React, { useRef, useState, useEffect } from "react";

export const MenuDetail: React.FC = () => {
  const [count, setCount] = useState(0);
  const countRef = useRef(0);
  useEffect(() => {
    console.log("use effect...", count);
    const timer = setInterval(() => {
      console.log("timer...count:", countRef.current);
      setCount(++countRef.current);
    }, 1000);
    return () => clearInterval(timer);
  }, []);

  return (
    <>
      <div>{count}</div>
    </>
  );
};
